var selecttreedivid,clickobjid,thetreename;

function getIE(e,so){
	//取得对象在屏幕的坐标
	//宽度（X坐标）:主框架树形宽度为180,边框宽7;机构IFRAME页面机构树宽190,边框宽6
	//高度（y坐标）:页面logo区高度54px;边框高度7
	var t=e.offsetTop;
	var l=e.offsetLeft;
	var sw = e.offsetWidth;
	var showobj = document.getElementById(so);
	while(e=e.offsetParent){
		t+=e.offsetTop;
		l+=e.offsetLeft;
	}
//	t = t+54+7;
//	l = l+180+190+7+6;
//	alert("top="+t+"\nleft="+l);
	showobj.style.left = l+'px';
	showobj.style.top = t+30+'px';
	
	showobj.style.display = 'block';
	document.onclick=hiddenDiv;
}


function seltree(obj,sdiv,treename){
	clickobjid = obj.id;
	selecttreedivid = sdiv;
	thetreename = treename;
	getIE(obj,sdiv);
}

function hiddenDiv(){
	var o=window.event.srcElement.id;
	if(o.indexOf(clickobjid)==0 || o.indexOf(selecttreedivid)==0 || o.indexOf("i"+thetreename)==0 || o.indexOf("j"+thetreename)==0){
		return;
	}else{
		if(document.getElementById(selecttreedivid).style.display!='none'){   
			document.getElementById(selecttreedivid).style.display='none';  
		}
	}
	
}